<?php include PATH_VIEWS . 'common/header.php'; ?>
<div class="main">
    <?php include PATH_VIEWS . 'common/left.php'; ?>
    <div class="main_right welcome_right" id="slide">
        <dl>
            <dt><h3>操作说明 <span>[关闭/展开]</span></h3></dt>
            <dd class="border">
                <span>以下红色边框的表单是必填项 。</span>
            </dd>
        </dl>
        <dl>
            <dt class="bottom">
            <h4>添加产品菜单</h4>
            </dt>
            <dd>
                <form id="form1" name="form1" method="post" action="<?php echo URL; ?>">
                    <table class="system_envir from_demo"> 
                        <tr>
                            <td>上级菜单名称</td>
                            <td>
                                <select name="FcateIds[]" onchange="getMenu(this.value)">
                                    <option value="0">顶级</option>
                                    <?php foreach ($menu_list as $ls) { ?>
                                        <option value="<?php echo $ls['Fid']; ?>"><?php echo $ls['Fname']; ?></option>
                                    <?php } ?>
                                </select>
                                <select id="showMenu" name="FcateIds[]" class="hide">

                                </select>
                            </td>
                            <td></td>
                        </tr>
                        <tr>
                            <td>菜单名称</td>
                            <td class="email"><input type="text" id="menuVal" name="Fname" value="" maxlength="16" data-rule="菜单名称:required;length[2~16]" data-target="#tishi"/></td>
                            <td id="tishi">在填写菜单名称时，请注意简短且要具有概括性。字符长度：2-16个</td>
                        </tr>                       
                        <tr>
                            <td>产品总数量</td>
                            <td><input type="text" id="sort" name="FtotalProductNum" value="1" maxlength="5"/></td>
                            <td class="tishi">产品的总数量</td>
                        </tr>
                        <tr>
                            <td>排序</td>
                            <td class="sort"><input type="text" id="sort" name="Fsort" value="1" maxlength="2"/></td>
                            <td class="tishi">数值越小，排列越前，数值大小范围：1-99</td>
                        </tr>
                        <tr>
                            <td>是否可见</td>
                            <td>
                                <select name="Fstatus" class="show">
                                    <option value="1">是</option>                           
                                    <option value="0">否</option>
                                </select>
                            </td>
                            <td></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td class="subbtn" colspan="2">
                                <input class="ok" type="submit" name="ok" value="确认提交">
                                <a href="javascript:void(0)" class="cancel">返回</a>
                            </td>
                        </tr>
                    </table>
                </form>
            </dd>
        </dl>
        <div id="test"></div>
    </div>
</div>
<?php include PATH_VIEWS . 'common/footer.php'; ?>
<script>
    function getMenu(parent_id) {
        if (parent_id == "0" || parent_id == "") {
            $("#showMenu").addClass("hide");
        } else {
            $("#showMenu").removeClass("hide");
        }
        if ($("#seleMenu").val() != "") {
            $("#moren").remove();
        }

//    取数据库菜单
        $.get('index.php?C=Web&A=menuGrade&pid=' + parent_id, function (data) {
            $('#showMenu').html(data);
        });
    }
</script>